package vfs.dao;

import java.io.Serializable;

import javax.persistence.Embeddable;

/**
 *
 * Composite Key.
 *
 * @author fwang2
 *
 */
@Embeddable
public class PathKey implements Serializable {


    private static final long serialVersionUID = -3735578080400995898L;
    private long descendant;
    private long ancestor;

    public PathKey(final long ancestor, final long descendant) {
        this.ancestor = ancestor;
        this.descendant = descendant;
    }

    public void setAncestor(final long ancestor) {
        this.ancestor = ancestor;

    }


    public void setDescendant(final long descendant) {
        this.descendant = descendant;
    }






    public final long getDescendant() {
        return descendant;
    }

    public final long getAncestor() {
        return ancestor;
    }

    public final boolean equals(final Object obj) {
        if (!(obj instanceof PathKey)) {
            return false;
        }

        final PathKey ppk = (PathKey) obj;

        return (this.ancestor == ppk.getAncestor())
            && (this.descendant == ppk.getDescendant());

    }

    public final int hashCode() {

        return String.valueOf(this.ancestor).hashCode()
            ^ String.valueOf(this.descendant).hashCode();
    }
}
